Skip to content

feat(server): Tauri-free server image and one implementation for app and web - #1255

Merged
NewtTheWolf merged 6 commits into
feat/web-uifrom
feat/web-slim
Oct 22, 2026
Merged

NewtTheWolf merged 6 commits into
feat/web-uifrom
feat/web-slim

Conversation

@NewtTheWolf

@NewtTheWolf NewtTheWolf commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up from #676 (comment). Targets feat/web-ui and should land before #676 is merged.

This PR has two parts:

Part 1: Server image without Tauri

What

  • desktop cargo feature (on by default) now gates tauri, tauri-build, gtk and every tauri-plugin-*. cargo build --no-default-features builds a server that only runs tabularis web and tabularis --mcp. Any other launch prints a hint and exits with code 2.
  • Tauri commands:
    • Commands that take Tauri types (AppHandle, State, windows) only compile with desktop.
    • Plain commands keep #[cfg_attr(feature = "desktop", tauri::command)] because the web RPC calls them directly.
    • Part 2 replaces this per-item gating: all Tauri code moves into transport/desktop, the only module behind desktop.
  • Async runtime: crate::async_rt re-exports Tauri's async_runtime in the desktop app and Tokio's task API otherwise. The web server already runs inside Tokio.
  • Unused code warnings: without desktop, helpers that only the Tauri wrappers use are silenced by one crate-level allow(unused_imports, dead_code). The desktop build still reports dead code.
  • Image: docker/Dockerfile builds with --no-default-features. The builder and runtime no longer contain WebKit or GTK, and the ldd-closure stage is gone. The runtime is debian:trixie-slim with ca-certificates, curl, tini, openssh-client and libdbus-1-3.
  • CI adds cargo check --locked --no-default-features --bin tabularis, so the server-only build keeps compiling.

Not changed

  • The desktop app. desktop is the default feature, so pnpm tauri dev, pnpm tauri build and the release workflows compile the same code as before. e2e-testing implies desktop.
  • Image tags: :latest stays the same Debian image.

Image size (amd64)

unpacked pulled (gzip)
with Tauri (Debian + WebKitGTK closure) 462 MB 176 MB
without Tauri 170 MB (−63 %) 58 MB (−67 %)

The server binary is 31 MB and links only libdbus, libsystemd, libcap, libgcc and glibc.

Verified (part 1)

  • cargo test --lib (desktop): 2154 passed
  • cargo check --no-default-features --bin tabularis: clean, no warnings
  • the default build: clean, no warnings
  • cargo check --features e2e-testing: clean, no warnings
  • docker/smoke-test.sh on the new image: 8/8
  • the DuckDB registry plugin answers execute_query inside the image (plugins are glibc binaries)
  • pnpm web:docs, helm lint and actionlint pass

How to test

docker build -f docker/Dockerfile -t tabularis:slim .
docker/smoke-test.sh tabularis:slim
cd src-tauri && cargo check --no-default-features --bin tabularis

Part 2: One implementation for app and web, Tauri in transport::desktop

Goal: app and web run the same logic, and Tauri lives in one place instead of behind cfg attributes all over the crate. This part takes the per-item cfg gating from part 1 and replaces it with one module boundary.

Five commits after the image commit, kept apart on purpose (.rules/rust.md rule 6):

  1. Route duplicated commands through the application layer (behaviour)
  2. Move all Tauri code into transport::desktop (structure only)
  3. e2e: list_databases against real Postgres/MySQL
  4. Remove the 15 commands the frontend never calls
  5. AGENTS.md: a notice at the top plus a "Backend layout" section, so contributors and their agents see the new structure. It sits outside the GitNexus-managed block, so re-indexing keeps it.

1. Desktop and web share the logic

Before, about 90 desktop commands had their own copy of logic the web RPC already got from application/. The biggest were connection save/update/duplicate/delete/test at 140 to 240 lines each. Those commands now call application/ too. The desktop app manages one Arc<ApplicationState>; its fields became Arcs, so the per-field Tauri state and the application layer share the same caches.

Desktop behaviour the application layer was missing moved there first, so the desktop app loses nothing and the web gains it:

  • Deleting a connection also removes its query history.
  • Deleting a group cleans up secrets, plugin secrets, icon and history of every connection in it. Neither side did this before.
  • AWS IAM connections:
    • they never fall back to a stored password;
    • testing one without a token fails with the actionable message;
    • duplicating one does not copy the token.
  • A URI the file marks as stored in the keychain but that is missing fails the connect with "Stored connection URI is unavailable in the OS keychain" instead of a driver error.
  • SSH secrets are only kept while the tunnel is enabled. An empty passphrase field keeps the stored passphrase.
  • Test connection:
    • an unknown connection id is treated as an ad-hoc connection;
    • the dbConnect progress step shows host:port.

Web parity gaps fixed on the way:

  • list_databases had no RPC route. The connection dialog could not load the database list in the browser. It now has a route with the same authorization rules as test_connection.
  • Editing a URI-passthrough connection in the browser failed with "Connection URI is required". The browser never receives the stored URI. The dialog now treats a keychain-only URI as present, and the input shows "Stored in the OS keychain…".
  • create_sqlite_database moved from the RPC handler into application/, so both transports use the same code.

Smaller fixes:

  • Theme package install from a path: the archive is read inside the cancellable install again, as its doc comment promises. This also fixes server-path installs on the web.
  • run_connections_backup returns the same object on both transports. The string branch in BackupTab and in the contract is gone.
  • Notebooks use the runtime paths.
  • kubectl calls no longer block the async runtime on desktop.
  • QueryHistoryState is removed; it was an empty marker type.

2. One Tauri transport

src-tauri/src/transport/
├── desktop/   ← every Tauri command, run(), windows, updater
└── web/
  • transport/desktop/<module>.rs mirrors the module the code came from.
  • Commands the web RPC also calls stay plain functions; transport/desktop holds a one-line #[tauri::command] wrapper for each.
  • run() moved from lib.rs unchanged. It still registers all 308 commands, and the generated inventory confirms the list is unchanged. After commit 4 it registers 293.
  • The askpass bridge stores the app's RuntimeEvents instead of a Tauri AppHandle, so askpass has no cfg left.
  • Outside transport/desktop, the only desktop gates are the transport::desktop declaration, async_rt and the run() dispatch in lib.rs.

The rule for new code is in .rules/rust.md (rule 7). CI enforces it with a grep: no tauri:: or tauri_plugin outside transport/desktop. A Tauri-only change therefore can't break the server build unnoticed.

Intentional differences that stay

Command Desktop Web
get_connection_by_id returns the stored secrets so the edit dialog can show them redacted; omitted fields keep the stored value on save
save_connection_icon, blob/SQL/explain file commands, imports/exports host paths from native dialogs upload/download tokens or the server file-browser roots
get_connections also runs the legacy embedded-SSH migration not needed: web never had that data
windows, updater, devtools, ChatGPT sign-in, deep links desktop only not applicable

Removed dead code

Each of these 15 registered commands was checked with rg -w across the repository: no caller in packages/, web-ui-project/, e2e/ or the plugin API. The plugin guide forbids plugins from invoking Tauri commands.

Command Why it was dead
list_all_preferences No caller.
get_theme Superseded by get_theme_catalog.
save_blob_to_file Blobs download through fetch_blob. The driver method of the same name stays.
preview_tabularis_import, apply_tabularis_import The frontend uses preview_tabularis_import_file and apply_prepared_tabularis_import.
export_connections_payload, import_connections_payload, encrypt_export_payload, decrypt_export_payload application/connection_files does the same work for the file-based flow.
open_visual_explain_window The --explain CLI path still opens the window through spawn_visual_explain_window.
open_json_viewer_window, get_json_viewer_session, complete_json_viewer_session, open_results_window, close_results_window The frontend opens these windows through WebviewWindow. Their Rust session stores were write-only, so the json_viewer and results_window modules and their ApplicationState fields went too.

That is about 740 lines.

Verified

  • Rust
    • cargo test --lib: 2135 passed. Before: 2154.
      • 20 tests of helpers that are now gone were removed.
      • 7 tests of the deleted window stores were removed.
      • 8 new tests cover the moved behaviour.
    • cargo check with default features, --features e2e-testing, --no-default-features --bin tabularis and --tests: no new warnings.
    • test:web-resilience passes.
  • Frontend
    • pnpm test: 7082 passed.
    • These checks pass: typecheck, lint, web:inventory, web:boundaries, web:packaging, web:docs, web:manual-parity, test:web-contract.
    • New test: the modal saves a keychain-only URI connection. It fails without the fix.
  • Web e2e
    • Chromium and Firefox: 10/10 against real SQLite/Postgres/MySQL and an external plugin, including the new list_databases check.
    • WebKit could not run locally because system libraries are missing; CI covers it.
  • Desktop smoke: the bundled debug app was started with an isolated profile and a seeded SQLite connection, and ran for 30 s.
    • Setup, schedulers and the frontend's startup commands ran.
    • There was no panic.
    • Every State<T> a command asks for is managed in run().
  • Docker: the image builds with --no-default-features, docker/smoke-test.sh passes 8/8, and the image size is unchanged.
  • GitNexus: detect_changes rates both refactor commits "critical". That reflects the number of moved and rerouted symbols. Tauri commands are called by name from the frontend, so the graph does not see those edges.

A default-on `desktop` feature now carries Tauri, its plugins, tauri-build
and gtk. `cargo build --no-default-features` produces a server that only
runs `tabularis web` and `--mcp` and links no GUI libraries.

Tauri commands that need Tauri types compile only with `desktop`; the
others keep `#[tauri::command]` behind `cfg_attr` because the web RPC calls
them directly. `async_rt` picks Tauri's runtime in the desktop app and the
ambient Tokio runtime otherwise.

The image drops from 462 MB to 170 MB unpacked (176 MB to 58 MB pulled).
It stays on Debian: registry driver plugins are glibc binaries and fail on
Alpine even with gcompat. CI checks the server-only build.
@kilo-code-bot

kilo-code-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Notes

  • The desktop feature gating is consistent: modules that only hold Tauri-typed commands (ai_commands, notebooks, task_manager, theme_commands, updater, window_*, ...) are gated whole, and the web RPC reaches the same behaviour through crate::application::*, which is not gated.
  • Plain commands the web RPC calls keep #[cfg_attr(feature = "desktop", tauri::command)].
  • async_rt swaps Tauri's runtime for Tokio's task API without changing call sites.
  • e2e-testing implies desktop, so the e2e dialog mock is unaffected.
  • The Dockerfile drops the frontend copy into the server stage and the GTK/WebKit packages. The web-ui stage still supplies the runtime assets.
  • The CI step runs cargo check --locked --no-default-features --bin tabularis.
  • Minor style-only observations, not flagged as findings:
    • Several #[cfg(feature = "desktop")] use ... lines sit inside functions that are already gated, for example chatgpt/auth.rs, chatgpt/mod.rs, plugins/commands.rs, storage_location.rs and updater.rs.
    • cfg_attr(feature = "desktop", ...) appears in the already-gated e2e_dialog_mock.rs and system_theme.rs.
    • A few #[cfg] attributes sit above /// doc comments. This is valid Rust, but it differs from the usual ordering.
  • Not run (read-only review): the build, tests and cargo check --no-default-features. The PR description reports these as passing.
Files Reviewed (56 files)
  • .github/workflows/ci.yml
  • docker/Dockerfile
  • src-tauri/Cargo.toml
  • src-tauri/build.rs
  • src-tauri/src/** (all 51 changed Rust files: gating, async_rt switch, lib.rs entry point split)
  • web-ui-project/docs/WEB_MODE_CONTAINERS.md

Reviewed by claude-sonnet-5.5 · Input: 272 · Output: 6.2K · Cached: 1.7M

Review guidance: REVIEW.md from base branch feat/web-ui

…layer

Desktop commands that had their own copy of logic the web RPC already gets
from `application/` now call the application layer, so both transports
behave the same. The desktop app manages one `Arc<ApplicationState>`; its
fields are `Arc`s so the per-field Tauri state shares the same instances.

Desktop behaviour the application layer lacked moved into it first:
- deleting a connection also removes its query history; a cascading group
  delete now cleans up secrets, plugin secrets, icons and history of every
  connection in the group (neither side did that before)
- AWS IAM connections never fall back to a stored password, testing one
  without a token fails with the actionable message, and duplicates do not
  copy the token
- a URI marked as stored in the keychain but missing fails a connect with
  a clear message
- SSH secrets are only kept while the tunnel is enabled, and an empty
  passphrase field keeps the stored one
- an unknown connection id in a test is treated as an ad-hoc connection;
  the dbConnect step shows host:port

Web parity fixes found on the way:
- `list_databases` had no RPC route; the connection dialog failed to load
  databases in the browser
- the connection dialog treats a URI that only lives in the keychain as
  present, so editing a passthrough connection no longer fails with
  "Connection URI is required"
- `create_sqlite_database` moved from the RPC handler into the application
  layer

Also: theme package installs from a path read the archive inside the
cancellable install again, `run_connections_backup` returns the same
object on both transports, notebooks use the runtime paths, and kubectl
calls no longer block the async runtime on desktop.
Tauri commands and everything that needs an AppHandle, a window or Tauri
state now live in `src-tauri/src/transport/desktop/`, next to
`transport/web`. It is the only module behind the `desktop` feature, so the
rest of the crate no longer carries per-item `cfg(feature = "desktop")` or
`cfg_attr(..., tauri::command)` attributes.

- `transport/desktop/<module>.rs` mirrors the module the code came from;
  commands the web RPC also calls stay plain functions and get a one-line
  Tauri wrapper there
- `run()` moved from lib.rs with the handler list unchanged (308 commands)
- the askpass bridge keeps the app's `RuntimeEvents` instead of a Tauri
  `AppHandle`
- helpers the desktop code needs became `pub(crate)`

No behaviour changes. `.rules/rust.md` documents the boundary and CI fails
when Tauri shows up outside `transport/desktop`.
None of these 15 registered commands has a caller in the frontend,
the e2e suites or the plugin API (plugins must not invoke Tauri commands):
list_all_preferences, get_theme, save_blob_to_file,
preview_tabularis_import, apply_tabularis_import,
export_connections_payload, import_connections_payload,
encrypt_export_payload, decrypt_export_payload,
open_visual_explain_window, open_json_viewer_window,
get_json_viewer_session, complete_json_viewer_session,
open_results_window and close_results_window.

The JSON viewer and results windows are opened from the frontend, so their
Rust session stores (`json_viewer`, `results_window`) were write-only and
go too. The driver method `save_blob_to_file` stays; only the command that
wrapped it is gone.
Points contributors and their agents at transport/desktop for Tauri code and lists what in-flight branches need to change when they rebase.
@NewtTheWolf NewtTheWolf changed the title feat(server): build the container image without Tauri feat(server): Tauri-free server image and one implementation for app and web Oct 22, 2026
@NewtTheWolf
NewtTheWolf merged commit 61d1d05 into feat/web-ui Oct 22, 2026
8 of 10 checks passed
@NewtTheWolf
NewtTheWolf deleted the feat/web-slim branch October 22, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant